Mule : Imap Provider
This page last changed on Apr 28, 2006 by rossmason.
The IMAP transport provider can be used to for receiving messages from IMAP inboxes and connecting to IMAP mailboxes using SSL (IMAPs) using the javax.mail api. The javadoc for this provider can be found here. org.mule.providers.email.ImapConnector. Imap Connector Properties
Imaps Connector PropertiesThe Imaps Connector enables Imap over SSL using the javax.mail APIs. It supports all the properties of the Imap connector and has some additional properties for setting up an SSL connection.
When using the Imaps Connector the default port is set to 993. Imap(s) EndpointsImap endpoints describe details about the connecting to a Imap mailbox. Imap URIs use the following syntax - imap://<user:password>@<imap server>[:port]/<mail folder>[?params] The format is the same for IMAPs - imaps://<user:password>@<imap server>[:port]/<mail folder>[?params]
For example, imaps://joe:[email protected]/mail?checkFrequency=30000 This will log into the imap.mycompany.com server with username joe using password 123456 (using default IMAPs port) and open the mail folder. It will check the mailbox for new messages every 30 seconds. To set additional properties on the endpoint, you can set them as parameters on the URI but we recommend you set them as endpoint properties to make it easier to read and maintain the configuration. <endpoint address="imaps://username:[email protected]/mail"> <properties> <property name="checkFrequency" value="120000"/> <property name="trustStore" value="./trustore"/> <property name="trustStorePassword" value="trustNoOne"/> </properties> </endpoint> FiltersFilters can be set on an endpoint to filter out any unwanted messages. The Mail transport provider has a couple of Email filters that can either be used directly or extended to implement custom filtering rules.
Configuring FiltersThe following demonstrates to only accept messages where the email subject starts with [mule] - <endpoint address="imaps://username:[email protected]/lists"> <filter className="org.mule.providers.email.filters.MailSubjectRegExFilter" pattern="\\[mule\\](.*)"/> <properties> <property name="checkFrequency" value="120000"/> <property name="trustStore" value="./trustore"/> <property name="trustStorePassword" value="trustNoOne"/> </properties> </endpoint> TransformersThere are a couple of transformers provided with the Email transport that are useful for converting javax.mail.Message to Mule event payloads. These transformers will extract the message body and properties (including headers) and handle attachments too. If you need to customise the behaviour of these transformers it is recommended that you extends the existing transformers rather than re-implement them.
|
Document generated by Confluence on Nov 27, 2006 10:27 |